<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html lang="en">
<head>

<meta name="generator" content="PHPDoctor 2RC2 (http://phpdoctor.sourceforge.net/)">
<meta name="when" content="Tue, 09 Dec 2008 09:11:43 +0000">

<link rel="stylesheet" type="text/css" href="../stylesheet.css">
<link rel="start" href="../overview-summary.html">

<title>FacetService (Moriarty)</title>

</head>
<body id="definition" onload="parent.document.title=document.title;">

<div class="header">
<h1>Moriarty</h1>
<ul>
<li><a href="../overview-summary.html">Overview</a></li>
<li><a href="../moriarty/package-summary.html">Package</a></li>
<li class="active">Class</li>
<li><a href="../moriarty/package-tree.html">Tree</a></li>
<li><a href="../deprecated-list.html">Deprecated</a></li>
<li><a href="../index-all.html">Index</a></li>
</ul>
</div>

<div class="small_links">
<a href="../index.html" target="_top">Frames</a>
<a href="../moriarty/facetservice.html" target="_top">No frames</a>
</div>
<div class="small_links">
Summary: <a href="#summary_field">Field</a> | <a href="#summary_method">Method</a> | <a href="#summary_constr">Constr</a>
Detail: <a href="#detail_field">Field</a> | <a href="#detail_method">Method</a> | <a href="#summary_constr">Constr</a>
</div>
<hr>

<div class="qualifiedName">Moriarty.FacetService</div>

<h1>Class FacetService</h1>

<pre class="tree"><strong>FacetService</strong><br /></pre>

<hr>

<p class="signature">public  class <strong>FacetService</strong></p>

<div class="comment" id="overview_description"><p>
Represents a store's facet service.</p></div>

<dl>
<dt>See Also:</dt>
<dd><a href="http://n2.talis.com/wiki/Facet_Service">http://n2.talis.com/wiki/Facet_Service</a></dd>
</dl>
<hr>

<table id="summary_constr">
<tr><th colspan="2">Constructor Summary</th></tr>
<tr>
<td class="description"><p class="name"><a href="#FacetService()">FacetService</a>(string uri, <a href="../moriarty/credentials.html">Credentials</a> credentials)</p><p class="description">
Create a new instance of this class</p></td>
</tr>
</table>

<table id="summary_method">
<tr><th colspan="2">Method Summary</th></tr>
<tr>
<td class="type"> <a href="../moriarty/httpresponse.html">HttpResponse</a></td>
<td class="description"><p class="name"><a href="#facets()">facets</a>(string query, array fields, in top)</p><p class="description">
Perform a facet query</p></td>
</tr>
<tr>
<td class="type"> array</td>
<td class="description"><p class="name"><a href="#facets_to_array()">facets_to_array</a>(string query, array fields, in top)</p><p class="description">
Perform a facet query and return the results as an array. </p></td>
</tr>
<tr>
<td class="type"> array</td>
<td class="description"><p class="name"><a href="#parse_facet_xml()">parse_facet_xml</a>(string xml)</p><p class="description">
Parse the response from a facet query into an array.</p></td>
</tr>
</table>

<h2 id="detail_constr">Constructor Detail</h2>
<h3 id="FacetService()">FacetService</h3>
<code class="signature">public <strong>FacetService</strong>(string uri, <a href="../moriarty/credentials.html">Credentials</a> credentials)</code>
<div class="details">
<p>
Create a new instance of this class</p><dl>
<dt>Parameters:</dt>
<dd>uri - URI of the facet service</dd>
<dd>credentials - the credentials to use for authenticated requests (optional)</dd>
</dl>
</div>

<hr>

<h2 id="detail_method">Method Detail</h2>
<h3 id="facets()">facets</h3>
<code class="signature">public  <a href="../moriarty/httpresponse.html">HttpResponse</a> <strong>facets</strong>(string query, array fields, in top)</code>
<div class="details">
<p>
Perform a facet query</p><dl>
<dt>Parameters:</dt>
<dd>query - the query to execute</dd>
<dd>fields - the list of fields to facet on</dd>
<dd>top - the number of facet results to return</dd>
</dl>
</div>

<hr>

<h3 id="facets_to_array()">facets_to_array</h3>
<code class="signature">public  array <strong>facets_to_array</strong>(string query, array fields, in top)</code>
<div class="details">
<p>
Perform a facet query and return the results as an array. An empty array is returned if there are any HTTP errors.</p><dl>
<dt>Parameters:</dt>
<dd>query - the query to execute</dd>
<dd>fields - the list of fields to facet on</dd>
<dd>top - the number of facet results to return</dd>
<dt>Returns:</dt>
<dd>see parse_facet_xml for the structure of this array</dd>
</dl>
</div>

<hr>

<h3 id="parse_facet_xml()">parse_facet_xml</h3>
<code class="signature">public  array <strong>parse_facet_xml</strong>(string xml)</code>
<div class="details">
<p>
Parse the response from a facet query into an array.
This method returns an associative array where the keys correspond to field name and the values are
associative arrays with two keys:
<ul>
<li><em>value</em> => the value of the field</li>
<li><em>number</em> => the associated number returned by the facet service</li>
</ul></p><dl>
<dt>Parameters:</dt>
<dd>xml - the facet response as an XML document</dd>
</dl>
</div>

<hr>

<div class="header">
<h1>Moriarty</h1>
<ul>
<li><a href="../overview-summary.html">Overview</a></li>
<li><a href="../moriarty/package-summary.html">Package</a></li>
<li class="active">Class</li>
<li><a href="../moriarty/package-tree.html">Tree</a></li>
<li><a href="../deprecated-list.html">Deprecated</a></li>
<li><a href="../index-all.html">Index</a></li>
</ul>
</div>

<div class="small_links">
<a href="../index.html" target="_top">Frames</a>
<a href="../moriarty/facetservice.html" target="_top">No frames</a>
</div>
<div class="small_links">
Summary: <a href="#summary_field">Field</a> | <a href="#summary_method">Method</a> | <a href="#summary_constr">Constr</a>
Detail: <a href="#detail_field">Field</a> | <a href="#detail_method">Method</a> | <a href="#summary_constr">Constr</a>
</div>
<hr>

<p id="footer">This document was generated by <a href="http://phpdoctor.sourceforge.net/">PHPDoctor: The PHP Documentation Creator</a></p>

</body>

</html>